<div class='console-panel bg-blur-white'>
	{include file='console:figure' /}
	<div class='weui-flex'>
		<div class='weui-flex__item'>
			<div class='weui-cells__title'>选择时间</div>
			<div class='weui-cells'>
				<div class='weui-cell'>
					<div class='weui-cell__bd'>
						<div class='weui-flex-center'>
							从
							&nbsp;
							<div class="input-append date" id="date-start" data-date-format="yyyy-mm-dd">
								<input autocomplete='off' class="weui-btn weui-btn_mini weui-btn_default" size="16" type="text" placeholder="选择开始日期">
								<span class="add-on"><i class="icon-th"></i></span>
							</div>
							&nbsp;
							到
							&nbsp;
							<div class="input-append date" id="date-end" data-date-format="yyyy-mm-dd">
								<input autocomplete='off' class="weui-btn weui-btn_mini weui-btn_default" size="16" type="text" placeholder="选择结束日期">
								<span class="add-on"><i class="icon-th"></i></span>
							</div>
							&nbsp;&nbsp;<small id='select-last-month' class='weui-cell_link pointer' style="cursor: pointer;">选择上个月</small>
							&nbsp;&nbsp;<small id='select-yesterday' class='weui-cell_link pointer' style="cursor: pointer;">选择昨天</small>
							&nbsp;&nbsp;<small id='select-day-before-yesterday' class='weui-cell_link pointer' style="cursor: pointer;">选择前天</small>
						</div>   
					</div>   
				</div>   
			</div>
			<div class='weui-cells__title'>业务报表</div>
			<div class='weui-cells'>
				<!--<div class='weui-cell'>-->
					<!--<div class='weui-cell__bd'>-->
						<!--用户 CLIENT-->
					<!--</div>-->
					<!--<small class='weui-cell__bd'>-->
						<!--<a href='/finance/client?code=utf-8' class='weui-cell_link'><i class='i i-exl' style='vertical-align: middle;'></i> 下载 utf-8</a>-->
						<!--&nbsp;-->
						<!--<a href='/finance/client?code=gb2312' class='weui-cell_link'><i class='i i-exl' style='vertical-align: middle;'></i> 下载 gb2312</a>-->
					<!--</small>-->
					<!--<div class='weui-cell__bd'>-->
					<!--</div>-->
					<!--<div class='weui-cell__bd'>-->
					<!--</div>-->
				<!--</div>-->

				<div class='weui-cell'>
					<div class='weui-cell__bd'>
						商城 MALL
					</div>
					<small class='weui-cell__bd'>
						<a href='http://api.hongyanche.com/finance/mall?code=utf-8' class='weui-cell_link'><i class='i i-exl' style='vertical-align: middle;'></i> 下载 utf-8</a>
						&nbsp;
						<a href='http://api.hongyanche.com/finance/mall?code=gb2312' class='weui-cell_link'><i class='i i-exl' style='vertical-align: middle;'></i> 下载 gb2312</a>
					</small>

					<!--<div class='weui-cell__bd'>-->
						<!--<small class='weui-cell__bd'>-->
							<!--<a href='/finance/campaign_daily?code=utf-8' class='weui-cell_link'><i class='i i-exl' style='vertical-align: middle;'></i> 日报 utf-8</a>-->
							<!--&nbsp;-->
							<!--<a href='/finance/campaign_daily?code=gb2312' class='weui-cell_link'><i class='i i-exl' style='vertical-align: middle;'></i> 日报 gb2312</a>-->
						<!--</small>-->
					<!--</div>-->
					<div class='weui-cell__bd'>
					</div>
				</div>
			</div>
			<div class='weui-cells__title'>支付平台报表</div>
			<div class='weui-cells'>
				<!--<div class='weui-cell'>-->
					<!--<div class='weui-cell__bd'>-->
						<!--<i class='i i-alipay'></i> 支付宝 ALIPAY-->
					<!--</div>-->
					<!--<small class='weui-cell__bd'>-->
						<!--<a href='/finance/alipay?code=utf-8' class='weui-cell_link'><i class='i i-exl' style='vertical-align: middle;'></i> 下载 utf-8</a>-->
					<!--</small>-->
					<!--<div class='weui-cell__bd'>-->
					<!--</div>-->
					<!--<div class='weui-cell__bd'>-->
					<!--</div>-->
				<!--</div>-->
				<div class='weui-cell'>
					<div class='weui-cell__bd'>
						<i class='i i-tenpay'></i> 微信支付 TENPAY
					</div>
					<small class='weui-cell__bd'>
						<a href='http://pay.weixin.qq.com' target="_blank" link class='weui-cell_link'>登陆微信商户中心</a>
						<!-- <a href='/finance/tenpay?code=utf-8' class='weui-cell_link'><i class='i i-exl' style='vertical-align: middle;'></i> 下载 utf-8</a> -->
						<!-- &nbsp; -->
						<!-- <a href='/finance/tenpay?code=gb2312' class='weui-cell_link'><i class='i i-exl' style='vertical-align: middle;'></i> 下载 gb2312</a> -->
					</small>
					<div class='weui-cell__bd'>
					</div>
					<div class='weui-cell__bd'>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	Date.prototype.format = function(fmt) { 
		var o = { 
			"M+" : this.getMonth()+1,                 
			"d+" : this.getDate(),                    
			"h+" : this.getHours(),                   
			"m+" : this.getMinutes(),                 
			"s+" : this.getSeconds(),                 
			"q+" : Math.floor((this.getMonth()+3)/3), 
			"S"  : this.getMilliseconds()             
		}; 
		if(/(y+)/.test(fmt)) {
			fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); 
		}
		for(var k in o) {
			if(new RegExp("("+ k +")").test(fmt)){
				fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
			}
		}
		return fmt; 
	}     
	function getCurrentMonthFirst(){
		var now = new Date();
		var date = new Date(now.getFullYear(),now.getMonth()-1,1);
		// var date=new Date();
		// date.setDate(1);
		date = date.format('yyyy-MM-dd');//formatDate(date,"yyyy-MM-dd");
		return date;
	}
	function getCurrentMonthLast(){
		var now = new Date();
		var date = new Date(now.getFullYear(),now.getMonth()-1,now.getDate());
		var currentMonth=date.getMonth();
		var nextMonth=++currentMonth;
		var nextMonthFirstDay=new Date(date.getFullYear(),nextMonth,1);
		var oneDay=1000*60*60*24;
		date = new Date(nextMonthFirstDay-oneDay);
		date = date.format('yyyy-MM-dd');
		return date;
	}
	$('#select-last-month').on('click', function(event) {
		$("#date-start input").val(getCurrentMonthFirst());
		$("#date-end input").val(getCurrentMonthLast());
	});
	$('#select-yesterday').on('click', function(event) {
		var yesterday = new Date();
		yesterday.setDate(yesterday.getDate()-1);
		yesterday = yesterday.format('yyyy-MM-dd');
		$("#date-start input").val(yesterday);
		$("#date-end input").val(yesterday);
	});
	$('#select-day-before-yesterday').on('click', function(event) {
		var dby = new Date();
		dby.setDate(dby.getDate()-2);
		dby = dby.format('yyyy-MM-dd');
		$("#date-start input").val(dby);
		$("#date-end input").val(dby);
	});
	var today = new Date();
	today = today.format('yyyy-MM-dd');
	$("#date-start input").val(today);
	$("#date-end input").val(today);
	$('a').not('[link]').on('click', function(event) {
		event.preventDefault();
		var url = $(this).attr('href');
		var start = $("#date-start input").val();
		var end = $("#date-end input").val();
		url = url + "&start=" + start +"&end=" + end;
		window.open(url)
	});
	$("#date-start input,#date-end input").datetimepicker({
		format 		: 'yyyy-mm-dd',
		language	: 'zh-CN',
		autoclose	: true,
		minView		: 2,
		todayBtn 	: 'linked',
		todayHighlight :true,
	});
</script>